Passed
Pull Request — master (#78)
by Mathieu
01:25
created

DailyRate   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 51
dl 0
loc 58
rs 10
c 0
b 0
f 0

6 Functions

Rating   Name   Duplication   Size   Complexity  
A getId 0 3 1
A getAmount 0 3 1
A getCustomer 0 3 1
A getUser 0 3 1
A getTask 0 3 1
A update 0 11 1
1
import {Entity, Column, PrimaryGeneratedColumn, ManyToOne} from 'typeorm';
2
import {Customer} from '../Customer/Customer.entity';
3
import {User} from '../User/User.entity';
4
import {Task} from '../Task/Task.entity';
5
6
@Entity()
7
export class DailyRate {
8
  @PrimaryGeneratedColumn('uuid')
9
  private id: string;
10
11
  @Column({type: 'integer', nullable: false})
12
  private amount: number;
13
14
  @Column({type: 'timestamp', default: () => 'CURRENT_TIMESTAMP'})
15
  private createdAt: Date;
16
17
  @ManyToOne(type => User, {nullable: false})
18
  private user: User;
19
20
  @ManyToOne(type => Customer, {nullable: false})
21
  private customer: Customer;
22
23
  @ManyToOne(type => Task, {nullable: false})
24
  private task: Task;
25
26
  constructor(amount: number, user: User, customer: Customer, task: Task) {
27
    this.amount = amount;
28
    this.user = user;
29
    this.customer = customer;
30
    this.task = task;
31
  }
32
33
  public getId(): string {
34
    return this.id;
35
  }
36
37
  public getAmount(): number {
38
    return this.amount;
39
  }
40
41
  public getUser(): User {
42
    return this.user;
43
  }
44
45
  public getTask(): Task {
46
    return this.task;
47
  }
48
49
  public getCustomer(): Customer {
50
    return this.customer;
51
  }
52
53
  public update(
54
    amount: number,
55
    user: User,
56
    customer: Customer,
57
    task: Task
58
  ): void {
59
    this.amount = amount;
60
    this.user = user;
61
    this.customer = customer;
62
    this.task = task;
63
  }
64
}
65